package handler

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func WeHook(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()

	if r.Method == http.MethodGet {
		for k, vs := range r.Form {
			fmt.Println("k: ", k)
			for _, v := range vs {
				fmt.Println("v: ", v)
			}
		}
	}

	if r.Method == http.MethodPost {
		body := r.Body
		bytes, err := ioutil.ReadAll(body)
		if err != nil {
			panic(err)
		}
		defer body.Close()

		fmt.Println(string(bytes))
	}

	w.Write([]byte("SUCCESS"))
}
